<?php

/**
 * This is the model class for table "{{admin}}".
 *
 * The followings are the available columns in table '{{admin}}':
 * @property integer $Id
 * @property string $username
 * @property string $userpwd
 * @property string $email
 * @property string $mobile
 * @property string $full_name
 * @property string $nick_name
 * @property integer $sta
 * @property string $reg_ip
 * @property integer $reg_time
 * @property string $last_loginip
 * @property integer $last_logintime
 * @property integer $update_time
 * @property integer $login_nums
 * @property string $note
 * @property integer $chg_name_flag
 */
class Admin extends AdminActiveRecord
{
	public $connectionPrefix='coodinn';//Do modify it.
	/**
	 * Returns the static model of the specified AR class.
	 * @param string $className active record class name.
	 * @return Admin the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return '{{admin}}';
	}
	/**
	 * Modify it if you need.
	 * @return mixed the primaryKey.
	 */
	public function primaryKey()
	{
		return 'id';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('sta, reg_time, last_logintime, update_time, login_nums, chg_name_flag', 'numerical', 'integerOnly'=>true),
			array('username, full_name, nick_name', 'length', 'max'=>32),
			array('userpwd, email', 'length', 'max'=>64),
			array('mobile', 'length', 'max'=>13),
			array('reg_ip, last_loginip', 'length', 'max'=>23),
			array('note', 'length', 'max'=>255),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('Id, username, userpwd, email, mobile, full_name, nick_name, sta, reg_ip, reg_time, last_loginip, last_logintime, update_time, login_nums, note, chg_name_flag', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'Id' => 'ID',
			'username' => 'Username',
			'userpwd' => 'Userpwd',
			'email' => 'Email',
			'mobile' => 'Mobile',
			'full_name' => 'Full Name',
			'nick_name' => 'Nick Name',
			'sta' => 'Sta',
			'reg_ip' => 'Reg Ip',
			'reg_time' => 'Reg Time',
			'last_loginip' => 'Last Loginip',
			'last_logintime' => 'Last Logintime',
			'update_time' => 'Update Time',
			'login_nums' => 'Login Nums',
			'note' => 'Note',
			'chg_name_flag' => 'Chg Name Flag',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('Id',$this->Id);
		$criteria->compare('username',$this->username,true);
		$criteria->compare('userpwd',$this->userpwd,true);
		$criteria->compare('email',$this->email,true);
		$criteria->compare('mobile',$this->mobile,true);
		$criteria->compare('full_name',$this->full_name,true);
		$criteria->compare('nick_name',$this->nick_name,true);
		$criteria->compare('sta',$this->sta);
		$criteria->compare('reg_ip',$this->reg_ip,true);
		$criteria->compare('reg_time',$this->reg_time);
		$criteria->compare('last_loginip',$this->last_loginip,true);
		$criteria->compare('last_logintime',$this->last_logintime);
		$criteria->compare('update_time',$this->update_time);
		$criteria->compare('login_nums',$this->login_nums);
		$criteria->compare('note',$this->note,true);
		$criteria->compare('chg_name_flag',$this->chg_name_flag);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}